package com.gy.edu.home;

import com.gy.edu.R;
import com.gy.edu.base.BaseActivity;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;

/**
 * Created by 高岳 on 2016/12/29.
 * Describe:
 */
public class VideoDetailActivity extends BaseActivity {

    private JCVideoPlayerStandard jcPlayer;
    private String path = "/sdcard/test/";
    String[] names = new String[]{"aa.mp4","bb.mp4","cc.mp4"};
    private int position;

    @Override
    protected void initView() {
        setContentViewRes(R.layout.activity_video_detail);
        hidenTop();
        position = getIntent().getIntExtra("position",0);
        jcPlayer = findView(R.id.jc_player);

        String paths ="file://"+path + names[position];

        jcPlayer.setUp(paths,
                JCVideoPlayer.SCREEN_LAYOUT_NORMAL,"");
//        jcPlayer.setUp("https://moufans-prod.oss-cn-shanghai.aliyuncs.com/20161206140741203Xh458k.mp4",
//                JCVideoPlayer.SCREEN_LAYOUT_NORMAL,"");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        JCVideoPlayer.releaseAllVideos();
    }

    @Override
    public void onBackPressed() {
        if(JCVideoPlayer.backPress()){
            return;
        }
        super.onBackPressed();
    }
}
